package com.houmeiyuan.huiguniang.ctrl;

import com.houmeiyuan.huiguniang.common.Result;
import com.houmeiyuan.huiguniang.service.ProductService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author lilanlan
 * @date 2019-08-11 20:09
 */
@RestController
@RequestMapping("/goods")
public class ProductCtrl extends BaseCtrl {
    @Autowired
    public ProductService productService;

    private static final Logger LOG = LoggerFactory.getLogger(ProductCtrl.class);

    /**
     * 获取商品信息
     * @param productId
     * @return
     */
    @RequestMapping ("/fetchByProductId")
    public Result findByProductId(@RequestParam("productId") Integer productId){
        LOG.info("/goods/fetchByProductId");
        Map<String, Object> params = new HashMap<>();
        if(productId != null && !"".equals(productId)) {
            params.put("productId", productId);
        }
        Map<String,Object> mp=new HashMap<>();

        return  send(productService.fetchByProductId(params));
    }

}
